﻿MPT.addAction("uspace", function(_elm) {

    var microblog_jQ = $('.e_microblog', _elm);

    var userID = Util.GetHashParam();

    var recordVisiter = function() {

        var data = { "targetId": userID };
        Backend.addVisitRecord(data, function(_resp) {
            if (Backend.resultValidate(_resp)) {
                $('.e_test').html('ID ' + userID + '，已记录脚印');
            }
        });
    };

    var displayMicroblog = function() {
        var blog_data = {};

        SiteUtil.getServerZone(function(_areaList) {
            blog_data.area_list = _areaList;
            blog_data.user_id = MPT.Config["session"]["userid"];

            //初始化微博空间，默认为“大家”
            everyone_jQ.click();
        });

        var initEveryone = function() {   //初始化大家
            everyone_jQ.click(function() {
                blog_data.blog_type = 0;
                var blog_list_plugin = BlogUtil.createMicroblogList(blog_data);
                microblog_jQ.empty().append(blog_list_plugin);
            });
        };
    };

    var initPage = function() {
        recordVisiter();

        SiteUtil.getServerZone(function(_areaList) {

            var blog_data = {};
            blog_data.area_list = _areaList;
            blog_data.user_id = userID;
            blog_data.blog_type = 3;

            var blog_list_plugin = BlogUtil.createMicroblogList(blog_data);
            microblog_jQ.empty().append(blog_list_plugin);
        });

    };

    initPage();
});